import React from "react" ;
import "./App.css";

class Header extends React.Component{
   constructor(props){
       super(props)
       this.state={
           list:[]
       }
   }
    render(){
        return(
            <div>
    <h2>留言板</h2>
    <div className="box">
                {this.state.list.map((item,index)=>{
                    return <div key={index}>
                            {item.title}
                              <img src={item.url} className="img"></img>
                              </div>
                })}
            </div>
</div>
        )
    }
    componentWillReceiveProps(p){
        this.props =p
        this.state.list.push({title:this.props.textlist,url:this.props.imgurl})
    }
}
export default  Header  